package com.zhixue.ucenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhixue.ucenter.model.po.ZxMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Dragon
 * @since 2023-10-13
 */
@Mapper
public interface ZxMenuMapper extends BaseMapper<ZxMenu> {


    /**
     * 根据用户id查询用户权限
     * @param userId
     * @return
     */
    @Select("SELECT	* FROM zx_menu WHERE id IN (SELECT menu_id FROM zx_permission WHERE role_id IN ( SELECT role_id FROM zx_user_role WHERE user_id = #{userId} ))")
    List<ZxMenu> selectPermissionByUserId(@Param("userId") String userId);;
}
